package com.example.administrator.customview;

import android.animation.ObjectAnimator;
import android.view.View;

/**
 * Created by Administrator on 2018/6/14.
 */

class RotateUtils {

    public static void viewRotate(View view,int start,int end,int duration) {
//        RotateAnimation animation = new RotateAnimation(start,end, Animation.ABSOLUTE,view.getWidth()/2,Animation.ABSOLUTE,view.getHeight());
//        //设置循环时间
//        animation.setDuration(1000);
//        //停留在循环后的状态
//        animation.setFillAfter(true);
//        //开始循环
//        view.startAnimation(animation);
        ObjectAnimator rotation = ObjectAnimator.ofFloat(view, "rotation", start, end);
        view.setPivotX(view.getWidth()/2);
        view.setPivotY(view.getHeight());
        rotation.setDuration(duration);
        rotation.start();

    }
}
